<?php
class Model_StudentMessageInbox extends CCMIS_Model {
    //Database student_message_inbox
    public function __construct(){
        parent::__construct();

        $this->load->database();
    }

    public function getAllByOwnerId($id)
    {
        $sql = "SELECT * FROM student_message_inbox WHERE StudentMemberIDInboxOwner = ?";
        $query =  $this->db->query($sql, $id);
        $result = $query->result_array();
        return $result;
    }

    public function add($studentMemberID, $messageThreadID)
    {
        $sql = 'INSERT INTO `student_message_inbox`(
        `StudentMemberIDInboxOwner`,
        `StudentMessageInboxThreadID`
        )
        VALUES (?, ?)';

        $this->db->query($sql, array($studentMemberID, $messageThreadID));

        return $this->db->insert_id();
    }

}